<%-- 
    Document   : setting
    Created on : 2019-7-17, 14:36:48
    Author     : dusin
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    session.setAttribute("url", "../main/recommend.jsp");
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="../../js/jquery/themes/default/easyui.css" type="text/css" />
        <link rel="stylesheet" href="../../js/jquery/themes/icon.css" type="text/css" />
        <script type="text/javascript" src="../../js/jquery/jquery.min.js"></script>
        <script type="text/javascript" src="../../js/jquery/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="../../js/jquery/locale/easyui-lang-zh_CN.js"></script>
        <script language="JavaScript">
            $(document).ready(function() {
                    $.extend($.fn.validatebox.defaults.rules, {  
                    /*必须和某个字段相等*/
                    recommendCode: {//验证手机号   
                        validator: function(value, param) {
                            return /^[0-9A-Za-z]{8}$/.test(value);
                        },
                        message: '请输入正确的推荐码，8位数字或者字母组合。'
                    }       
                 });               
                
                
                $('#fm-mobile').form({
                    url:'../../servlet/web/setting/UpdateRecommendCode',
                    onSubmit:function(){
			return $(this).form('validate');
                    },
                    success:function(data){
                        var result = eval('(' + data + ')');
			$.messager.alert('Info', result.msg, 'info');                        
                    }
                });
                
            });
        
            function changeRecommendCode(){
                   $.messager.confirm('提示',
                            '您确定要修改推荐码吗?', function(r) {
                                if (r) {
                                    $('#fm-mobile').form('submit');
                                }
                            });
                
            }
        </script>        

    </head>
    <body>       
        <div id="p" class="easyui-panel" title="推荐码设置"
             style="width:500px;height:150px;padding:10px;background:#fafafa;"
             data-options="iconCls:'icon-save',maximized:true">            
             <form id="fm-mobile" method="post" >            
                <div class="fitem">
                    <label>推荐码:</label>
                    <input id="recommendCode" name="code" class="easyui-textbox" validType="recommendCode"   required="true" value="${recommendCode}">
                </div>                       
            </form>
            <div id="mobile-buttons">
                <a href="#" style="margin-left: 120px;margin-top:30px;padding-left:30px" class="easyui-linkbutton" iconCls="icon-ok" onclick="changeRecommendCode()">确定</a>                
            </div>
        </div>
        <style type="text/css">
            #fm{
                margin:0;
                padding:10px 30px;
            }
            .ftitle{
                font-size:14px;
                font-weight:bold;
                padding:5px 0;
                margin-bottom:10px;
                border-bottom:1px solid #ccc;
            }
            .fitem{
                margin-bottom:5px;
            }
            .fitem label{
                display:inline-block;
                width:80px;
            }
            .fitem input{
                width:160px;
            }
        </style>
    </body>
</html>
